package com.holyant.goods.enums;

import lombok.Getter;

/**
 * @author zgx *
 * @date 2023年12月19日 13:51
 */
@Getter
public enum SkuMaintenanceHistoryQuoteTypeEnum {

    GUIDE_PRICE(10, "指引价"),
    SETTLE_PRICE(20, "结算价"),
    AGENCY_PRICE(30, "代发价");

    private final Integer code;
    private final String name;

    SkuMaintenanceHistoryQuoteTypeEnum(Integer code, String name)
    {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (SkuMaintenanceHistoryQuoteTypeEnum item : SkuMaintenanceHistoryQuoteTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (SkuMaintenanceHistoryQuoteTypeEnum item : SkuMaintenanceHistoryQuoteTypeEnum.values()) {
            if (item.getName().equals(name)) {
                return item.code;
            }
        }
        return null;
    }

}
